<?php
if($_POST['savecontent']=="Save"){
	$mce = urlencode(trim($_POST['mce']));
	$siteid = $site['id'];
	dbUpdate('sites',array("vision='$mce'"),array("id=$siteid"));
}
?>
<h2>Vision</h2>
	<div class="posts" id="posts">
			<form name="contentform" action="<?php echo $thisroot ?>/vision.php" method="post">
			<table>
				<tr>
					<td>
					<?php
						echo 	'<div align="left" width="650">';
					if($isadmin == 1){
						echo '<textarea class="mceEditor" name="mce" id="mce">';
					}
					if($_POST['savecontent'] && $_POST['savecontent']=="Save"){
						echo urldecode($mce);
					}else{
						echo '<div class="post">';
							if($site['vision']){echo urldecode($site['vision']);}
						echo '</div>';
					}
					if($isadmin == 1){
						echo '</textarea>';
						$formmode = 'edit';
					}else{
						$formmode = 'link';
					}
					echo '</div>';

					?>
					</td>
				</tr>
				<?php if($isadmin == 1){
				echo '<tr>
					<td align="right">
						
						<input type="submit" name="savecontent" value="Save" />
					</td>
				</tr>';
				} ?>
			</table>
				<input type="hidden" name="mode" value="<?php echo $formmode; ?>" />
			</form>
	</div>